import java.awt.*;  

import javax.swing.*;  
import javax.swing.border.TitledBorder;
import javax.swing.plaf.basic.BasicArrowButton;
   
public class MainThree extends JApplet {  
	private JButton jb = new JButton("Button");

	  private BasicArrowButton up = new BasicArrowButton(BasicArrowButton.NORTH),
	      down = new BasicArrowButton(BasicArrowButton.SOUTH),
	      right = new BasicArrowButton(BasicArrowButton.EAST),
	      left = new BasicArrowButton(BasicArrowButton.WEST);

	  public void init() {
	    Container cp = getContentPane();
	    cp.setLayout(new FlowLayout());
	    cp.add(jb);
	    cp.add(new JToggleButton("Toggle"));
	    cp.add(new JCheckBox("CheckBox"));
	    cp.add(new JRadioButton("RadioButton"));
	    JPanel jp = new JPanel();
	    jp.setBorder(new TitledBorder("Directions"));
	    jp.add(up);
	    jp.add(down);
	    jp.add(left);
	    jp.add(right);
	    cp.add(jp);
	    cp.add(new MainThree());
	  }
	  
	int[] data = { 25, 60, 42, 75,33,45,72,12 };  
    final int PAD = 20;  
   
    protected void paintComponent(Graphics g) {  
        super.paintComponents(g);  
        Graphics2D g2 = (Graphics2D)g;  
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,  
                            RenderingHints.VALUE_ANTIALIAS_ON);  
        int w = getWidth();  
        int h = getHeight(); 
        g2.drawLine(100, 100, 0,0);  
        g2.drawLine(PAD, h-PAD, w-PAD, h-PAD);  
        double xScale = (w - 2*PAD)/(data.length + 1);  
        double maxValue = 100.0;  
        double yScale = (h - 2*PAD)/maxValue;  
        // The origin location.  
        int x0 = PAD;  
        int y0 = h-PAD;  
        g2.setPaint(Color.red);  
        for(int j = 0; j < data.length; j++) {  
            int x = x0 + (int)(xScale * (j+1));  
            int y = y0 - (int)(yScale * data[j]);  
            g2.fillOval(x-2, y-2, 4, 4);  
        }  
    }  
   
    public static void main(String[] args) {  
    	run(new MainTwo(), 350, 100); 
    }  
    public static void run(JApplet applet, int width, int height) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(applet);
        frame.setSize(width, height);
        applet.init();
        applet.start();
        frame.setVisible(true);
      }
}  